﻿using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using My.Core.Model;
using My.Core.Quartz.Server;
using My.Core.Quartz.Server.iServer;
using My.Framework;
using My.Framework.AspNetCore;
using Quartz.Spi;
using SqlSugar;
using SqlSugar.IOC;

namespace My.Core.JobTasks
{
    public class JobTasksStartup : StartupModule<JobTasksStartup>
	{
		/// <summary>
		/// 程序启动器
		/// </summary>
		public JobTasksStartup() => Order = 999;

		/// <summary>
		/// 
		/// </summary>
		/// <param name="webApplicationBuilder"></param>
		public override void ConfigureServices(WebApplicationBuilder webApplicationBuilder)
		{

			var service = webApplicationBuilder.Services;

			//添加Quartz服务
			service.AddSingleton<IJobFactory, JobFactory>();

			service.AddTransient<ITaskSchedulerServer, TaskSchedulerServer>();
		}

		/// <summary>
		/// 
		/// </summary>
		/// <param name="webApplication"></param>
		public override void Configure(WebApplication webApplication)
		{
			
		}
	}
}
